package com.shiguo365.market.presenter.implement;

import android.app.Fragment;
import android.support.annotation.NonNull;
import android.util.Log;

import com.alibaba.fastjson.JSONObject;
import com.shiguo365.market.display.view.IIndexView;
import com.shiguo365.market.display.view.ISearchView;
import com.shiguo365.market.presenter.contract.ISearchPresenter;

import java.util.List;

import biz.yfsoft.api.ae.api.AEClient;
import biz.yfsoft.api.ae.api.AEParam;
import biz.yfsoft.api.ae.api.BaseAECallback;

/**
 * Created by caomenglong on 16/8/1.
 */
public class SearchPresenter implements ISearchPresenter {
    private static final String TAG = "SearchPresenter";
    private final Fragment mfragment;
    private final ISearchView mView;

    public SearchPresenter(@NonNull Fragment fragment, @NonNull ISearchView view) {
        this.mfragment = fragment;
        this.mView = view;
    }
    @Override
    public void getAllTags() {
        Log.d(TAG,"getAllTags");

        AEClient _client = new AEClient("shiguo.data.getAllTags");
        _client.call(new AEParam(),new BaseAECallback() {

            @Override
            public void onSuccess(JSONObject a) {
                Log.d(TAG,a.toString());
                mView.onGetAllTagsOk(a);
            }

            @Override
            public void onError( String errno, String message) {
                Log.e(TAG,"onFailure ......." + errno + ";message:" + message);
            }

            @Override
            public void onFinally(String s){
                mView.onGetAllTagsFinish();
            }
        });
    }
}
